<div class="hbox hbox-auto-xs hbox-auto-sm" ng-init="
    app.settings.asideFolded = false;
    app.settings.asideDock = false;
  ">
    <!-- main -->
    <div class="col">
        <!-- main header -->
        <div class="bg-light lter b-b wrapper-md">
            <div class="row">
                <div class="col-sm-6 col-xs-12">
                    <h1 class="m-n font-thin h3 text-black">GatewayAdmin</h1>
                    <small class="text-muted">网关层配置管理</small>
                </div>
            </div>
        </div>
        <!-- / main header -->
        <div class="wrapper-md">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
            <!-- / toaster directive -->
            <uib-tabset>
                <div ng-controller="gatewayadminCtrl">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <form class="form-inline" role="form">
                                <div class="form-group">
                                    <div class="input-group">
                                        <span class="input-group-addon">服务器组名称</span>
                                        <input type="text" class="form-control" ng-model="queryGroupName"
                                               placeholder="serverGroupName">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="input-group">
                                        <span class="input-group-addon">应用名称</span>
                                        <input type="text" class="form-control" ng-model="queryAppName"
                                               placeholder="appName">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <button type="button" class="btn btn-info" ng-click="doQuery()"><span
                                            class="glyphicon glyphicon-search"></span>搜索
                                    </button>
                                    <button type="button" class="btn btn-info" ng-click="reSet()"><span
                                            class="glyphicon glyphicon-repeat"></span>重置
                                    </button>
                                    <button type="button" class="btn btn-success" ng-click="sync()">
                                        <i class="fa fa-spin fa-spinner" ng-show="butSync"></i>
                                        <i class="glyphicon glyphicon-refresh" ng-show="!butSync"></i>扫描配置
                                    </button>
                                    <button type="button" class="btn btn-info" ng-click="batchSet()">
                                        <i class="fa fa-spin fa-spinner" ng-show="butBatchSet"></i>
                                        <i class="glyphicon glyphicon-play" ng-show="!butBatchSet"></i>批量配置
                                    </button>
                                </div>
                            </form>
                            <div style="margin-top: 5px;">
                                <table class="table table-hover table-bordered table-striped">
                                    <thead>
                                    <tr>
                                        <td class="col-md-2">服务器组</td>
                                        <td class="col-md-2">应用名称</td>
                                        <td>配置详情</td>
                                        <td>配置文件</td>
                                        <td class="col-md-1">操作</td>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr ng-repeat="item in pageData">
                                        <td>
                                            <b style="color: #286090">{{item.serverGroupName}}</b>
                                        </td>
                                        <td>
                                            <b style="color: #286090">{{item.appName}}</b>
                                        </td>
                                        <td>
                                            <li>
                                                <span class="label" style="background-color: #777; color: white;">RoutePath</span>
                                                <span class="label" style="background-color: green; color: white;">{{item.routePath}}</span>
                                            </li>
                                            <li>
                                                <span class="label" style="background-color: #777; color: white;">HealthCheckPath</span>
                                                <span class="label" style="background-color: green; color: white;">{{item.healthCheckPath}}</span>
                                            </li>
                                            <li>
                                                <span class="label" style="background-color: #777; color: white;">ServiceTest</span>
                                                <span class="label" style="background-color: green; color: white;">{{item.serviceTest}}</span>
                                            </li>
                                            <li>
                                                <span class="label" style="background-color: #777; color: white;">ServicePre</span>
                                                <span class="label" style="background-color: green; color: white;">{{item.servicePre}}</span>
                                            </li>
                                        </td>
                                        <td>
                                            <li>
                                                <span class="label" style="background-color: #777; color: white;">TEST</span>
                                                <span class="icon icon-info" style="color: #ff8700"
                                                      uib-popover-html="'最近一次配置存在问题！'" popover-trigger="'mouseenter'"
                                                      ng-show="!item.testSuccess"></span>

                                                <button ng-click="preview(item.id,5)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #20a03f; color: white;">
                                                    <span class="glyphicon glyphicon-search"></span>预览
                                                </button>

                                                <button ng-click="appSet(item.id,5)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                    <span class="glyphicon glyphicon-play"></span>App
                                                </button>
                                                <button ng-click="appServerSet(item.id,5)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                    <span class="glyphicon glyphicon-play"></span>AppServer
                                                </button>
                                                <button ng-click="appServerList(item.id,5)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2ea8e5; color: white;">
                                                    <span class="glyphicon glyphicon-search"></span>查询
                                                </button>
                                            </li>
                                            <li>
                                                <span class="label" style="background-color: #777; color: white;">PRE</span>
                                                <span class="icon icon-info" style="color: #ff8700"
                                                      uib-popover-html="'最近一次配置存在问题！'" popover-trigger="'mouseenter'"
                                                      ng-show="!item.preSuccess"></span>
                                                <!--7-->
                                                <button ng-click="preview(item.id,7)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #20a03f; color: white;">
                                                    <span class="glyphicon glyphicon-search"></span>预览
                                                </button>
                                                <button ng-click="appSet(item.id,7)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                    <span class="glyphicon glyphicon-play"></span>App
                                                </button>
                                                <button ng-click="appServerSet(item.id,7)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                    <span class="glyphicon glyphicon-play"></span>AppServer
                                                </button>
                                                <button ng-click="appServerList(item.id,7)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2ea8e5; color: white;">
                                                    <span class="glyphicon glyphicon-search"></span>查询
                                                </button>
                                            </li>
                                            <li>
                                                <span class="label" style="background-color: #777; color: white;">PROD</span>
                                                <span class="icon icon-info" style="color: #ff8700"
                                                      uib-popover-html="'最近一次配置存在问题！'" popover-trigger="'mouseenter'"
                                                      ng-show="!item.prodSuccess"></span>
                                                <!--4-->
                                                <button ng-click="preview(item.id,4)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #20a03f; color: white;">
                                                    <span class="glyphicon glyphicon-search"></span>预览
                                                </button>
                                                <button ng-click="appSet(item.id,4)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                    <span class="glyphicon glyphicon-play"></span>App
                                                </button>
                                                <button ng-click="appServerSet(item.id,4)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                    <span class="glyphicon glyphicon-play"></span>AppServer
                                                </button>
                                                <button ng-click="appServerList(item.id,4)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2ea8e5; color: white;">
                                                    <span class="glyphicon glyphicon-search"></span>查询
                                                </button>

                                            </li>

                                        </td>
                                        <td>
                                            <button ng-click="delGatewayadmin(item.id)"
                                                    class="btn btn-xs pull-right"
                                                    style="background-color: red; color: white;">
                                                <span class="glyphicon glyphicon-remove"></span>删除
                                            </button>
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="6">
                                            <ul style="margin: 0px; float: right;" uib-pagination
                                                total-items="totalItems" ng-model="currentPage"
                                                items-per-page="pageLength" max-size="10" ng-change="pageChanged()"
                                                previous-text="&lsaquo;" next-text="&rsaquo;"></ul>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </uib-tabset>
        </div>
    </div>
    <!-- / main -->
</div>


<script type="text/ng-template" id="appSetInfoModal">
    <div ng-include="'tpl/modal/gatewayadmin/appset_info_modal.html'"></div>
</script>


<script type="text/ng-template" id="appServerListInfoModal">
    <div ng-include="'tpl/modal/gatewayadmin/appserver_list_info_modal.html'"></div>
</script>
